ThinkPHP5


think\console\output\Question
library\think\console\output\Question.php at line 14

Class Question

Question
All Known Subclasses:
think\console\output\question\Choice think\console\output\question\Confirmation

public class Question


Constructor Summary
void

__construct(string question, mixed default)

构造方法

Method Summary
string

getQuestion()

获取问题

mixed

getDefault()

获取默认答案

bool

isHidden()

是否隐藏答案

Question

setHidden(bool hidden)

隐藏答案

bool

isHiddenFallback()

不能被隐藏是否撤销

Question

setHiddenFallback(bool fallback)

设置不能被隐藏的时候的操作

null|array|\Traversable

getAutocompleterValues()

获取自动完成

Question

setAutocompleterValues(null|array|\Traversable values)

设置自动完成的值

Question

setValidator(null|callable validator)

设置答案的验证器

null|callable

getValidator()

获取验证器

Question

setMaxAttempts(null|int attempts)

设置最大重试次数

null|int

getMaxAttempts()

获取最大重试次数

Question

setNormalizer(string|\Closure normalizer)

设置响应的回调

string|\Closure

getNormalizer()

获取响应回调 The normalizer can ba a callable (a string), a closure or a class implementing __invoke.

protected void

isAssoc(mixed array)

Constructor Detail

library\think\console\output\Question.php at line 31

__construct

public void __construct(string question, mixed default)

构造方法

Parameters:
question - 问题
default - 默认答案

Method Detail

library\think\console\output\Question.php at line 41

getQuestion

public string getQuestion()

获取问题


library\think\console\output\Question.php at line 50

getDefault

public mixed getDefault()

获取默认答案


library\think\console\output\Question.php at line 59

isHidden

public bool isHidden()

是否隐藏答案


library\think\console\output\Question.php at line 69

setHidden

public Question setHidden(bool hidden)

隐藏答案


library\think\console\output\Question.php at line 84

isHiddenFallback

public bool isHiddenFallback()

不能被隐藏是否撤销


library\think\console\output\Question.php at line 94

setHiddenFallback

public Question setHiddenFallback(bool fallback)

设置不能被隐藏的时候的操作


library\think\console\output\Question.php at line 105

getAutocompleterValues

public null|array|\Traversable getAutocompleterValues()

获取自动完成


library\think\console\output\Question.php at line 117

setAutocompleterValues

public Question setAutocompleterValues(null|array|\Traversable values)

设置自动完成的值

Throws:
\InvalidArgumentException
\LogicException

library\think\console\output\Question.php at line 143

setValidator

public Question setValidator(null|callable validator)

设置答案的验证器

Returns:
The current instance

library\think\console\output\Question.php at line 154

getValidator

public null|callable getValidator()

获取验证器


library\think\console\output\Question.php at line 165

setMaxAttempts

public Question setMaxAttempts(null|int attempts)

设置最大重试次数

Throws:
\InvalidArgumentException

library\think\console\output\Question.php at line 180

getMaxAttempts

public null|int getMaxAttempts()

获取最大重试次数


library\think\console\output\Question.php at line 190

setNormalizer

public Question setNormalizer(string|\Closure normalizer)

设置响应的回调


library\think\console\output\Question.php at line 202

getNormalizer

public string|\Closure getNormalizer()

获取响应回调 The normalizer can ba a callable (a string), a closure or a class implementing __invoke.


library\think\console\output\Question.php at line 207

isAssoc

protected void isAssoc(mixed array)

ThinkPHP5